package com.program.cloudmanage.tripteam.persistence;

import com.program.cloudmanage.tripteam.domain.Car;
import com.program.cloudmanage.tripteam.domain.Person;
import org.apache.ibatis.annotations.*;

import java.util.List;

public interface CarMapper {
    @Select("select * from car")
    List<Car> showCar();

    @Select("select * from car where car.teamid = #{teamid}")
    List<Car> searchCarByTeamId(String teamid);

    @Select("select * from car where car.personid = #{personid}")
    Car searchCarByPersonId(String personid);

    @Select("select * from car where car.carid = #{carid}")
    Car searchCar(String carid);

    @Insert("insert into car(carid,personid,type,date,style,information,place,direction,color,teamid) values (#{carid},#{personid},#{type},#{date},#{style},#{information},#{place},#{direction},#{color},#{teamid})")
    void insertCar(@Param("carid")String carid,@Param("personid")String personid,@Param("type")String type,@Param("date")String date,@Param("style")String style,@Param("information")String information,@Param("place")String place,@Param("direction")String direction,@Param("color")String color,@Param("teamid")String teamid);

    @Delete("delete from car where carid = #{carid}")
    void deleteCar(String carid);
    @Update("update car set personid=#{personid},type=#{type},date=#{date},style=#{style},information=#{information},place=#{place},direction=#{direction},color=#{color} where carid=#{carid}")
    void updateCar(@Param("carid")String carid,@Param("personid")String personid,@Param("type")String type,@Param("date")String date,@Param("style")String style,@Param("information")String information,@Param("place")String place,@Param("direction")String direction,@Param("color")String color);

}
